from rest_framework import serializers

from .models import *


class HostsSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = HostsLists
        fields = ('systemname', 'servicename', 'clustername', 'hostname', 'ip')


class AnsibleTasksSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = AnsibleTasks
        fields = ('url', 'id', 'AnsibleID', 'CeleryID', 'TaskUser', 'TaskName', 'playbook', 'ExtraVars',
                  'AnsibleResult', 'CeleryResult', 'Label', 'CreateTime')


class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('url', 'id', 'username', 'email')


class PlaybooksSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Playbooks
        fields = ('remark', 'nickName', 'playbook')